/***************************************************************************
* Copyright (C) 2012, Chain Studios.
*
* This file is part of QeffectsGL source code.
*
* QeffectsGL source code is free software; you can redistribute it
* and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* QeffectsGL source code is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
***************************************************************************/
#include "qfx_library.h"
#include "qfx_log.h"
#include "qfx_settings.h"
#include "qfx_opengl.h"

//=========================================
// DLL Entry Point
//-----------------------------------------
// Init and shutdown global DLL data
//=========================================

void
#ifdef __GNUC__
__attribute__ ((constructor))
#endif
OnAttach(void);

void
#ifdef __GNUC__
__attribute__ ((destructor))
#endif
OnDetach(void);


void OnAttach(void)
{
    QFXLog::Instance();
    fprintf(stderr, "onattach");
    QFXSettings::Instance();
}

void OnDetach(void)
{
    gl::Shutdown();
}

#ifdef _WIN32
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )
{
    switch (ul_reason_for_call)
	{
		case DLL_PROCESS_ATTACH:
			OnAttach();
			break;
		case DLL_PROCESS_DETACH:
			OnDetach();
			break;
		default:
			break;
    }
    return TRUE;
}
#endif
